package com.example.glxt1.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;


@Configuration
@EnableSwagger2//开启Swagger2配置
public class swaggerConfig  {
    @Bean
    public Docket getDocket(){
        Docket docket=new Docket(DocumentationType.SWAGGER_2);
        //指定接口
        docket.apiInfo(getApiInfo())
                .select()//指定监控哪些接口
                .apis(
                        RequestHandlerSelectors.basePackage("com.example.glxt1.controller")
                ).paths(PathSelectors.any())//指定文档的扫描范围
                .build();
        return docket;
    }
    public ApiInfo getApiInfo(){
        ApiInfo res=new ApiInfoBuilder()
                .title("管理系统")
                .description("描述信息")
                .version("v2.0")
                .contact(
                        new Contact("zhangsan","url","123.qq.com")
                ).build();
        return res;

    }

}
